//
//  LJMRankSubRoot_Soner_AlbumTableViewCell.m
//  wind
//
//  Created by 李金明 on 16/1/12.
//  Copyright © 2016年 李金明. All rights reserved.
//

#import "LJMRankSubRoot_Soner_AlbumTableViewCell.h"

@implementation LJMRankSubRoot_Soner_AlbumTableViewCell

- (void)dealloc
{
    [_nameStr release];
    [_imageV release];
    [_timeLab release];
    [_titleLab release];
    [_nameLab release];
    [super dealloc];
}
- (void)setNameStr:(NSString *)nameStr
{
    if (_nameStr != nameStr) {
        [_nameStr release];
        _nameStr = [nameStr retain];
        
    }
    CGFloat width = [LJMAdaption_Height_Width widthWithStr:nameStr NSInter:12];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLab.mas_left);
        make.top.equalTo(self.titleLab.mas_bottom);
        make.height.equalTo(self.titleLab.mas_height);
        make.width.mas_equalTo(width);
    }];
    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLab.mas_right);
        make.top.equalTo(self.nameLab.mas_top);
        make.bottom.equalTo(self.nameLab.mas_bottom);
        make.width.mas_equalTo(@100);
    }];
    
 
    
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return self;
}
- (void)creatView
{
    self.backgroundColor = [UIColor whiteColor];
    //主图
    self.imageV = [[UIImageView alloc] init];
    self.imageV.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.imageV];
    [_imageV release];
    
    //标题
    self.titleLab = [[UILabel alloc] init];
    self.titleLab.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.titleLab];
    [_titleLab release];
    
    //添加作者名
    self.nameLab = [[UILabel alloc] init];
    self.nameLab.backgroundColor = [UIColor clearColor];
    self.nameLab.textColor = [UIColor grayColor];
    self.nameLab.font = [UIFont systemFontOfSize:12.0];
    [self.contentView addSubview:self.nameLab];
    [_nameLab release];
    
    //添加日期
    self.timeLab = [[UILabel alloc] init];
    self.timeLab.backgroundColor = [UIColor clearColor];
    self.timeLab.textColor = [UIColor grayColor];
    self.timeLab.font = [UIFont systemFontOfSize:12.0];
    [self.contentView addSubview:self.timeLab];
    [_timeLab release];

}
- (void)layoutSubviews
{
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(5);
        make.bottom.equalTo(self.mas_bottom).offset(-5);
        make.width.mas_equalTo(self.bounds.size.width * (1 / 3.0));
    }];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imageV.mas_right).offset(10);
        make.top.mas_equalTo(self.imageV.mas_top);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(@30);
    }];
    

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
